package com.atguigu.day13.morning.m2;

import org.junit.Test;

import java.util.Comparator;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/15 8:43
 * @注释
 */
public class Test1 implements Comparator<Student> {

   @Test
   public void test01(){
       Student s1 = new Student("张三", 19, 99.6);
       Student s2 = new Student("李四", 18, 95.5);

       int a = compare(s1,s2);
       System.out.println(a);
   }

    @Override
    public int compare(Student o1, Student o2) {
        if (o1.score > o2.score){
            return 1;
        }else if (o1.score < o2.score){
            return -1;
        }else {
            return 0;
        }
    }
}
